<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/pages/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <title>权限新增</title>
    <%@ include file="/WEB-INF/pages/include/baseCSS.jsp"%>
</head>

<body>
<!-- Field Validation -->
<div class="panel" style="height:100%">
  <div class="panel-body" style="height:100%">
    <form class="form-horizontal" role="form" id="perm-form" >
     <div class="bs-component">
        <div class="form-group has-primary">
          <div class="col-xs-9">
	          <label class="col-lg-3 control-label text-right" for="permkey">权限键值</label>
	          <div class="col-lg-8">
	            <span class="append-icon right">
	              <i class="fa fa-gear"></i>
	            </span>
	            <input type="hidden" id="id" name="id" value="${perm.id}">
	            <input type="text" class="form-control" id="permkey" name="permkey" value="${perm.permkey}" required>
	          </div>
          </div>
        </div>
      </div>
      <div class="bs-component">
        <div class="form-group has-success">
          <div class="col-xs-9">
	          <label class="col-lg-3 control-label text-right" for="permname">权限名称</label>
	          <div class="col-lg-8">
	            <span class="append-icon right">
	              <i class="fa fa-gear"></i>
	            </span>
	            <input type="text" class="form-control" id="permname" name="permname" value="${perm.permname}" required>
	          </div>
          </div>
        </div>
      </div>
      <div class="bs-component">
        <div class="form-group has-info">
         <div class="col-xs-9">
          <label class="col-lg-3 control-label" for="permtype">权限类型</label>
          <div class="col-lg-8">
            <span class="append-icon right">
              <i class="fa fa-exclamation-circle"></i>
            </span>
           <%--  <input type="number" class="form-control" name="permtype" id="permtype" value="${perm.permtype}" required> --%>
           <input type="hidden" id="hidPermType" value="${perm.permtype}"/>
            <select class="form-control" name="permtype" id="permtype">
              <option value="">请选择</option>
			  <option value="1">页面</option>
			  <option value="2">按钮</option>
			  <option value="3">其他</option>
			</select>
          </div>
         </div>
        </div>
      </div>
      <div class="bs-component">
        <div class="form-group has-error">
         <div class="col-xs-9">
	          <label class="col-lg-3 control-label text-right" for="parentid">上级权限</label>
	          <div class="col-lg-8">
	            <span class="append-icon right">
	              <i class="fa fa-bullseye"></i>
	            </span>
	            <div class="drop-select-tree" data-tree-value="${perm.parentid}" data-tree-class="form-control" data-tree-id="parentid" data-tree-name="parentid" data-tree-url="${ctx}/perm/tree"></div>
	          </div>
          </div>
        </div>
      </div>
      <div class="bs-component">
        <div class="form-group has-warning">
          <div class="col-xs-9">
	          <label class="col-lg-3 control-label text-right" for="description">权限描述</label>
	          <div class="col-lg-8">
	            <span class="append-icon right">
	              <i class="fa fa-gear"></i>
	            </span>
	            <input type="text" class="form-control" id="description" name="description" value="${perm.description}" required>
	          </div>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>

<%@ include file="/WEB-INF/pages/include/baseJS.jsp"%>
<script type="text/javascript">
	var validatorForm = validator("perm-form").addFields({
	   permkey: {
		   rules: 'required',
		   messages: "不能为空"
	   },
	   permname: {
	       rules: 'required',
	       messages: "不能为空"
	   }
	});
	jQuery(document).ready(function() {
		$("select option[value='"+$("#hidPermType").val()+"']").attr("selected",true);
	});
</script>
<!-- END: PAGE SCRIPTS -->
</body>
</html>
